﻿using System;
using System.Collections.Generic;
using System.Xml.Linq;

using Perseus.Xml;

using Hetymine.Executioner.Commands;

namespace Hetymine.Executioner.Plugins {
    public class SendKeysCommand : IExecutable, IMultiInput {        
        public SendKeysCommand(XElement element) {
            this.Name = element.Element("Name").ValueOrEmpty();
            this.Keys = element.Element("Keys").ValueOrEmpty();

            this.Inputs = new List<string>(new string[] { "string", "audio" });
            this.EnabledInputs = Helper.Inputs(element.Attribute("Inputs"), this.Inputs.ToArray());
        }

        public string Name { get; set; }
        public string Keys { get; set; }
        
        public bool Execute(string command) {
            //System.Windows.Forms.SendKeys.SendWait(this.Keys);
            return false;
        }
        
        #region IMultiInput Members
        public List<string> Inputs { get; protected set; }
        public List<string> EnabledInputs { get; protected set; }
        public void EnableInput(string input) {
            if (this.Inputs.Contains(input)) {
                if (!this.EnabledInputs.Contains(input)) {
                    this.EnabledInputs.Add(input);
                }
            }
        }
        public void DisableInput(string input) {
            this.EnabledInputs.Remove(input);
        }
        #endregion
    }
}
